package com.itsu.mysql.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.itsu.interfaces.entity.ManageUser;
import com.itsu.interfaces.service.ManageUserService;
import com.itsu.mysql.mappers.ManageUserMapper;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

@Service
public class ManageUserServiceImpl implements ManageUserService {

    @Autowired
    ManageUserMapper manageUserMapper;


    @Override
    public ManageUser login(String username, String password) {
        return manageUserMapper.selectOne(Wrappers.lambdaQuery(ManageUser.class)
                .eq(ManageUser::getUsername, username)
                .eq(ManageUser::getPassword, password));
    }

    @Override
    public ManageUser findUser(Long uid) {
        return manageUserMapper.selectOne(Wrappers.lambdaQuery(ManageUser.class)
                .eq(ManageUser::getId, uid));
    }
}
